import 'package:baselib/utils/color_base_util.dart';
import 'package:baselib/utils/drawable_base_util.dart';
import 'package:baselib/utils/image_util.dart';
import 'package:baselib/utils/px_base_util.dart';
import 'package:baselib/widgets/inkwell_button.dart';
import 'package:flutter/material.dart';

class CommClickWidget extends StatelessWidget{
  String preImgPath;
  double preImgWidth;
  double preImgHeight;
  Color preImgColor;
  Color titlecColor;
  String title;
  double titleSize;
  FontWeight titleFontWeight;
  String cont;
  Color contColor;
  Color contFontSize;
  String rightImgPath;
  double rightImgWidth;
  double rightImgHeight;
  Function onItemClick;
  BoxDecoration itemBoxDecoration;
  Color itemColor;
  double itemHeight;
  EdgeInsetsGeometry itemPadding;


  CommClickWidget({
    this.preImgPath,
    this.preImgWidth,
    this.preImgHeight,
    this.preImgColor,
    this.titlecColor,
    this.titleFontWeight,
    this.title,
    this.titleSize,
    this.cont,
    this.contColor,
    this.contFontSize,
    this.rightImgPath,
    this.rightImgWidth,
    this.rightImgHeight,
    this.itemBoxDecoration,
    this.itemColor,
    this.itemHeight,
    this.itemPadding,
    this.onItemClick,
});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return InkWellButton(
      onPressed: (onItemClick==null)?(){}:()=>onItemClick(),
      child: Container(
        height: itemHeight??PxBaseUtil().px_43,
        decoration: itemBoxDecoration??BoxDecoration(
          color: itemColor??Colors.white,
          border: Border(
            bottom: BorderSide(
              color: ColorBaseUtil().color_f2f2f2,
            )
          )
        ),
        padding: itemPadding??EdgeInsets.only(
          left: PxBaseUtil().px_12,
          right: PxBaseUtil().px_12,
        ),
        child: Row(
          children: [
            (preImgPath??'').isEmpty?Container(width: PxBaseUtil().px_0,):
            Container(
              child:
              ImagesUtil.loadAssetImage(
                  preImgPath??DrawableBaseUtil().icon_default_head,
                  width: preImgWidth??PxBaseUtil().px_21,
                  height: preImgHeight,
                  color:preImgColor
              ),
            ),
            (preImgPath??'').isEmpty?Container(width: PxBaseUtil().px_0,):
            SizedBox(width: PxBaseUtil().px_10,),
            Container(
              child: Text(
                '${title??''}',
                style: TextStyle(
                  color: titlecColor??ColorBaseUtil().color_383838,
                  fontSize: titleSize??PxBaseUtil().px_18,
                  fontWeight: titleFontWeight??FontWeight.normal
                ),
              ),
            ),
            SizedBox(width: PxBaseUtil().px_10,),
            Expanded(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    Container(
                      padding: EdgeInsets.only(
                          bottom: PxBaseUtil().px_2
                      ),
                      child: Text(
                        '${cont??''}',
                        style: TextStyle(
                          color: contColor??ColorBaseUtil().color_777777,
                          fontSize: contFontSize??PxBaseUtil().px_14,
                        ),
                      ),
                    ),
                  ],
                )
            ),
            SizedBox(width: PxBaseUtil().px_10,),
            Container(
              child: ImagesUtil.loadAssetImage(
                rightImgPath??DrawableBaseUtil().icon_arrow_right_white,
                width:rightImgWidth??PxBaseUtil().px_8,
                fit: BoxFit.fitWidth
              ),
            )
          ],
        ),
      ),
    );
  }

}